package com.sghd.pojo.fight.game;

/**
 * @author frank
 * @date 2018-11-09 10:24
 * @desc
 **/
public class Result<T> {
    private int code;
    private T body;

    public static <T> Result<T> valueOf(int code) {
        Result<T> result = new Result();
        result.code = code;
        return result;
    }

    public static <T> Result<T> SUCCESS() {
        Result<T> result = new Result();
        result.code = 0;
        return result;
    }

    public static <T> Result<T> valueOf(T body) {
        Result<T> result = new Result();
        result.body = body;
        return result;
    }

    public static <T> Result<T> valueOf(int code, T body) {
        Result<T> result = new Result();
        result.body = body;
        result.code = code;
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getBody() {
        return body;
    }

    public void setBody(T body) {
        this.body = body;
    }
}
